@burtson-labs/bandit-engine 2.0.147 → 2.0.149

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  chat_default
3
- } from "./chunk-XHFMXI6Z.mjs";
3
+ } from "./chunk-ANX33XAO.mjs";
4
4
  import "./chunk-ONQMRE2G.mjs";
5
5
  import "./chunk-P5IJLX6I.mjs";
6
6
  import "./chunk-K2JGFKEB.mjs";
@@ -13,4 +13,4 @@ import "./chunk-BJTO5JO5.mjs";
13
13
  export {
14
14
  chat_default as default
15
15
  };
16
- //# sourceMappingURL=chat-2JZRC4SF.mjs.map
16
+ //# sourceMappingURL=chat-Z4SQGSMN.mjs.map
@@ -4287,6 +4287,10 @@ ${protocol}`;
4287
4287
  /\b(?:web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
4288
4288
  );
4289
4289
  if (callIdx !== -1) t = t.slice(0, callIdx);
4290
+ const jsonIdx = t.search(
4291
+ /\{\s*"name"\s*:\s*"(?:web_search|web_fetch|image_generation|create_file|ask_user)"/
4292
+ );
4293
+ if (jsonIdx !== -1) t = t.slice(0, jsonIdx);
4290
4294
  t = t.replace(/```[\w-]*\s*$/, "");
4291
4295
  const fenceCount = (t.match(/```/g) || []).length;
4292
4296
  if (fenceCount % 2 === 1) t = t.slice(0, t.lastIndexOf("```"));
@@ -4352,6 +4356,9 @@ ${protocol}`;
4352
4356
  const visibleMessage = stripThinking(fullMessage);
4353
4357
  const bareToolMatch = visibleMessage.match(
4354
4358
  /\b(web_search|web_fetch|image_generation|create_file|ask_user)\s*\(/
4359
+ ) || // JSON-form calls from cloud/native-tool engines.
4360
+ visibleMessage.match(
4361
+ /\{\s*"name"\s*:\s*"(web_search|web_fetch|image_generation|create_file|ask_user)"/
4355
4362
  );
4356
4363
  if (/```(?:tool_code|TOOL_CODE)/.test(visibleMessage) || bareToolMatch) {
4357
4364
  sawToolBlock = true;
@@ -4479,6 +4486,70 @@ ${fn}(${argStr})
4479
4486
  }
4480
4487
  return out;
4481
4488
  };
4489
+ const bridgeJsonToolBlobs = (message) => {
4490
+ const KNOWN = ["web_search", "web_fetch", "image_generation", "create_file", "ask_user", "ask-user"];
4491
+ const re = new RegExp(`\\{\\s*"name"\\s*:\\s*"(${KNOWN.join("|")})"`, "g");
4492
+ const spans = [];
4493
+ let m;
4494
+ while ((m = re.exec(message)) !== null) {
4495
+ let depth = 0;
4496
+ let i = m.index;
4497
+ let inStr = false;
4498
+ let esc = false;
4499
+ for (; i < message.length; i++) {
4500
+ const ch = message[i];
4501
+ if (esc) {
4502
+ esc = false;
4503
+ continue;
4504
+ }
4505
+ if (ch === "\\") {
4506
+ esc = true;
4507
+ continue;
4508
+ }
4509
+ if (ch === '"') {
4510
+ inStr = !inStr;
4511
+ continue;
4512
+ }
4513
+ if (inStr) continue;
4514
+ if (ch === "{") depth++;
4515
+ else if (ch === "}") {
4516
+ depth--;
4517
+ if (depth === 0) {
4518
+ i++;
4519
+ break;
4520
+ }
4521
+ }
4522
+ }
4523
+ const blob = message.slice(m.index, i);
4524
+ try {
4525
+ const parsed = JSON.parse(blob);
4526
+ const args = parsed.arguments ?? parsed.parameters ?? parsed.input ?? {};
4527
+ let start = m.index;
4528
+ let end = i;
4529
+ const fenceOpen = message.slice(0, start).match(/```[a-zA-Z0-9_-]*[ \t]*\n[ \t]*$/);
4530
+ if (fenceOpen) {
4531
+ start -= fenceOpen[0].length;
4532
+ const fenceClose = message.slice(end).match(/^[ \t]*\n?```/);
4533
+ if (fenceClose) end += fenceClose[0].length;
4534
+ }
4535
+ spans.push({
4536
+ start,
4537
+ end,
4538
+ fn: parsed.name,
4539
+ args: typeof args === "string" ? args : JSON.stringify(args)
4540
+ });
4541
+ } catch {
4542
+ }
4543
+ re.lastIndex = i;
4544
+ }
4545
+ let result = message;
4546
+ for (let k = spans.length - 1; k >= 0; k--) {
4547
+ const s = spans[k];
4548
+ result = result.slice(0, s.start) + "\n```tool_code\n" + s.fn + "(" + s.args + ")\n```\n" + result.slice(s.end);
4549
+ }
4550
+ return result;
4551
+ };
4552
+ fullMessage = bridgeJsonToolBlobs(fullMessage);
4482
4553
  const toolCallMatches = extractToolCalls(fullMessage);
4483
4554
  let enhancedMessage = fullMessage;
4484
4555
  const summarizableResults = [];
@@ -7762,7 +7833,7 @@ import {
7762
7833
  Avatar as Avatar7,
7763
7834
  Chip as Chip4
7764
7835
  } from "@mui/material";
7765
- import { X as CloseIcon7, X as ClearIcon2, Search as SearchIcon2, Folder as FolderIcon5, MoreVertical as MoreVertIcon4, Trash2 as DeleteSweepIcon2, Inbox as InboxIcon4, Plus as AddIcon5, Settings as SettingsIcon2, Brain as MemoryIcon2, LogOut as LogOutIcon2, House as HomeLucideIcon2, RefreshCw as SyncLucideIcon2, CircleAlert as SyncErrorIcon2, SlidersHorizontal as ManagementIcon2 } from "lucide-react";
7836
+ import { X as CloseIcon7, X as ClearIcon2, Search as SearchIcon2, Folder as FolderIcon5, MoreVertical as MoreVertIcon4, Trash2 as DeleteSweepIcon2, Inbox as InboxIcon4, Plus as AddIcon5, Brain as MemoryIcon2, LogOut as LogOutIcon2, House as HomeLucideIcon2, RefreshCw as SyncLucideIcon2, SlidersHorizontal as ManagementIcon2 } from "lucide-react";
7766
7837
  import { useTheme as useTheme14, alpha as alpha9 } from "@mui/material/styles";
7767
7838
  import { Fragment as Fragment9, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
7768
7839
  var BANDIT_AVATAR2 = "https://cdn.burtson.ai/images/bandit-head.png";
@@ -8178,47 +8249,27 @@ var EnhancedMobileConversationsModal = ({
8178
8249
  }
8179
8250
  }
8180
8251
  ),
8181
- syncEnabled && /* @__PURE__ */ jsx17(
8182
- IconButton11,
8252
+ syncEnabled && syncStatus === "syncing" && /* @__PURE__ */ jsx17(
8253
+ Box14,
8183
8254
  {
8184
- onClick: () => {
8185
- if (syncStatus !== "syncing") void runSync({ force: true });
8186
- },
8187
- "aria-label": "Sync conversations",
8255
+ component: "span",
8188
8256
  sx: {
8189
- color: syncStatus === "error" ? theme.palette.error.main : theme.palette.text.secondary,
8190
- ...syncStatus === "syncing" && {
8191
- animation: "bandit-sync-spin 1s linear infinite",
8192
- "@keyframes bandit-sync-spin": {
8193
- "0%": { transform: "rotate(0deg)" },
8194
- "100%": { transform: "rotate(360deg)" }
8195
- }
8257
+ display: "inline-flex",
8258
+ mr: 0.5,
8259
+ animation: "bandit-sync-spin 1s linear infinite",
8260
+ "@keyframes bandit-sync-spin": {
8261
+ "0%": { transform: "rotate(0deg)" },
8262
+ "100%": { transform: "rotate(360deg)" }
8196
8263
  }
8197
8264
  },
8198
- children: syncStatus === "error" ? /* @__PURE__ */ jsx17(SyncErrorIcon2, {}) : /* @__PURE__ */ jsx17(SyncLucideIcon2, {})
8199
- }
8200
- ),
8201
- /* @__PURE__ */ jsx17(
8202
- IconButton11,
8203
- {
8204
- onClick: () => setMemoryModalOpen(true),
8205
- "aria-label": "Memory",
8206
- sx: { color: theme.palette.text.secondary },
8207
- children: /* @__PURE__ */ jsx17(MemoryIcon2, {})
8208
- }
8209
- ),
8210
- /* @__PURE__ */ jsx17(
8211
- IconButton11,
8212
- {
8213
- onClick: () => setProjectManagementOpen(true),
8214
- sx: { color: theme.palette.text.secondary },
8215
- children: /* @__PURE__ */ jsx17(FolderIcon5, {})
8265
+ children: /* @__PURE__ */ jsx17(SyncLucideIcon2, { size: 18, color: theme.palette.text.secondary })
8216
8266
  }
8217
8267
  ),
8218
8268
  /* @__PURE__ */ jsx17(
8219
8269
  IconButton11,
8220
8270
  {
8221
8271
  onClick: handleMenuOpen,
8272
+ "aria-label": "Conversation options",
8222
8273
  sx: { color: theme.palette.text.secondary },
8223
8274
  children: /* @__PURE__ */ jsx17(MoreVertIcon4, {})
8224
8275
  }
@@ -8747,46 +8798,27 @@ var EnhancedMobileConversationsModal = ({
8747
8798
  children: /* @__PURE__ */ jsx17(ManagementIcon2, { size: 16 })
8748
8799
  }
8749
8800
  ),
8750
- user && /* @__PURE__ */ jsxs14(Fragment9, { children: [
8751
- /* @__PURE__ */ jsx17(
8752
- Box14,
8753
- {
8754
- sx: {
8755
- flexShrink: 0,
8756
- display: "flex",
8757
- alignItems: "center",
8758
- justifyContent: "center",
8759
- width: 30,
8760
- height: 30,
8761
- borderRadius: "50%",
8762
- border: `1px solid ${alpha9(theme.palette.divider, 0.8)}`,
8763
- color: theme.palette.text.secondary
8764
- },
8765
- children: /* @__PURE__ */ jsx17(SettingsIcon2, { size: 16 })
8766
- }
8767
- ),
8768
- /* @__PURE__ */ jsx17(
8769
- IconButton11,
8770
- {
8771
- "aria-label": "Sign out",
8772
- title: "Sign out",
8773
- onClick: (event) => {
8774
- event.stopPropagation();
8775
- authenticationService.clearToken();
8776
- window.location.href = "/login";
8777
- },
8778
- sx: {
8779
- flexShrink: 0,
8780
- width: 30,
8781
- height: 30,
8782
- border: `1px solid ${alpha9(theme.palette.error.main, 0.4)}`,
8783
- color: theme.palette.error.main,
8784
- "&:hover": { bgcolor: alpha9(theme.palette.error.main, 0.1) }
8785
- },
8786
- children: /* @__PURE__ */ jsx17(LogOutIcon2, { size: 16 })
8787
- }
8788
- )
8789
- ] })
8801
+ user && /* @__PURE__ */ jsx17(Fragment9, { children: /* @__PURE__ */ jsx17(
8802
+ IconButton11,
8803
+ {
8804
+ "aria-label": "Sign out",
8805
+ title: "Sign out",
8806
+ onClick: (event) => {
8807
+ event.stopPropagation();
8808
+ authenticationService.clearToken();
8809
+ window.location.href = "/login";
8810
+ },
8811
+ sx: {
8812
+ flexShrink: 0,
8813
+ width: 30,
8814
+ height: 30,
8815
+ border: `1px solid ${alpha9(theme.palette.error.main, 0.4)}`,
8816
+ color: theme.palette.error.main,
8817
+ "&:hover": { bgcolor: alpha9(theme.palette.error.main, 0.1) }
8818
+ },
8819
+ children: /* @__PURE__ */ jsx17(LogOutIcon2, { size: 16 })
8820
+ }
8821
+ ) })
8790
8822
  ]
8791
8823
  }
8792
8824
  )
@@ -8812,7 +8844,7 @@ var EnhancedMobileConversationsModal = ({
8812
8844
  currentProjectId: conversationToMove.projectId
8813
8845
  }
8814
8846
  ),
8815
- /* @__PURE__ */ jsx17(
8847
+ /* @__PURE__ */ jsxs14(
8816
8848
  Menu5,
8817
8849
  {
8818
8850
  anchorEl: menuAnchorEl,
@@ -8826,21 +8858,62 @@ var EnhancedMobileConversationsModal = ({
8826
8858
  vertical: "bottom",
8827
8859
  horizontal: "right"
8828
8860
  },
8829
- children: /* @__PURE__ */ jsxs14(
8830
- MenuItem5,
8831
- {
8832
- onClick: () => {
8833
- setClearConfirmOpen(true);
8834
- handleMenuClose();
8835
- },
8836
- disabled: visibleConversationCount === 0,
8837
- sx: { color: theme.palette.error.main },
8838
- children: [
8839
- /* @__PURE__ */ jsx17(ListItemIcon4, { children: /* @__PURE__ */ jsx17(DeleteSweepIcon2, { size: 16, color: theme.palette.error.main }) }),
8840
- /* @__PURE__ */ jsx17(ListItemText4, { children: "Clear All Conversations" })
8841
- ]
8842
- }
8843
- )
8861
+ children: [
8862
+ /* @__PURE__ */ jsxs14(
8863
+ MenuItem5,
8864
+ {
8865
+ onClick: () => {
8866
+ setMemoryModalOpen(true);
8867
+ handleMenuClose();
8868
+ },
8869
+ children: [
8870
+ /* @__PURE__ */ jsx17(ListItemIcon4, { children: /* @__PURE__ */ jsx17(MemoryIcon2, { size: 16 }) }),
8871
+ /* @__PURE__ */ jsx17(ListItemText4, { children: "Memories" })
8872
+ ]
8873
+ }
8874
+ ),
8875
+ /* @__PURE__ */ jsxs14(
8876
+ MenuItem5,
8877
+ {
8878
+ onClick: () => {
8879
+ setProjectManagementOpen(true);
8880
+ handleMenuClose();
8881
+ },
8882
+ children: [
8883
+ /* @__PURE__ */ jsx17(ListItemIcon4, { children: /* @__PURE__ */ jsx17(FolderIcon5, { size: 16 }) }),
8884
+ /* @__PURE__ */ jsx17(ListItemText4, { children: "Manage projects" })
8885
+ ]
8886
+ }
8887
+ ),
8888
+ syncEnabled && /* @__PURE__ */ jsxs14(
8889
+ MenuItem5,
8890
+ {
8891
+ onClick: () => {
8892
+ if (syncStatus !== "syncing") void runSync({ force: true });
8893
+ handleMenuClose();
8894
+ },
8895
+ children: [
8896
+ /* @__PURE__ */ jsx17(ListItemIcon4, { children: /* @__PURE__ */ jsx17(SyncLucideIcon2, { size: 16 }) }),
8897
+ /* @__PURE__ */ jsx17(ListItemText4, { children: "Sync now" })
8898
+ ]
8899
+ }
8900
+ ),
8901
+ /* @__PURE__ */ jsxs14(
8902
+ MenuItem5,
8903
+ {
8904
+ onClick: () => {
8905
+ setClearConfirmOpen(true);
8906
+ handleMenuClose();
8907
+ },
8908
+ disabled: visibleConversationCount === 0,
8909
+ sx: { color: theme.palette.error.main },
8910
+ children: [
8911
+ /* @__PURE__ */ jsx17(ListItemIcon4, { children: /* @__PURE__ */ jsx17(DeleteSweepIcon2, { size: 16, color: theme.palette.error.main }) }),
8912
+ /* @__PURE__ */ jsx17(ListItemText4, { children: "Clear All Conversations" })
8913
+ ]
8914
+ }
8915
+ )
8916
+ ]
8844
8917
  }
8845
8918
  ),
8846
8919
  /* @__PURE__ */ jsxs14(
@@ -11145,7 +11218,7 @@ var ChatContent = () => {
11145
11218
  // reads as full physical height with the rounded corner visible
11146
11219
  // where it overlaps the drawer.
11147
11220
  transform: isMobile && mobileConversationsOpen ? "translateX(calc(min(calc(100vw - 56px), 360px) - 12px))" : "none",
11148
- borderRadius: isMobile && mobileConversationsOpen ? "36px" : 0,
11221
+ borderRadius: isMobile && mobileConversationsOpen ? "44px" : 0,
11149
11222
  zIndex: isMobile && mobileConversationsOpen ? theme.zIndex.modal + 1 : 0,
11150
11223
  // Hairline border so the rounded card reads even when the backdrop
11151
11224
  // is the same near-black as the shell.
@@ -11471,4 +11544,4 @@ var chat_default = Chat;
11471
11544
  export {
11472
11545
  chat_default
11473
11546
  };
11474
- //# sourceMappingURL=chunk-XHFMXI6Z.mjs.map
11547
+ //# sourceMappingURL=chunk-ANX33XAO.mjs.map